package com.shiliao.app.utils;

import com.shiliao.app.ShiliaoApplication;
import com.yimei.framework.util.PreferenceHelper;

import static com.shiliao.app.utils.YMKeyUtils.KEY_TEST_SERVER;

/**
 * 所有接口列表
 * Created by yjl on 2017/7/13.
 */

public class YMServerUtil {


    public static final String ServerHost = "http://api.yimeizhishi.com";//线上地址
    public static final String ServerTest = "http://192.168.100.218";  //测试地址


//    public static final String ServerTest = "http://192.168.11.152:9002";  //长燕电脑测试地址

    public static final String SERVER_PORT = "/meirongknowledge";

    public static final String ImageUrl = "";  //图片的线上地址

    public static final String ImageUrl_TEST = "";  //图片的测试地址

    /**
     * 获取后台地址
     */
    public static String getServerUrl() {
        if (YMConfig.YM_IS_RELEASE) {
            return ServerHost;
        } else {
            return ServerHost_TEST + SERVER_PORT;
        }
    }

    public static String getImageUrl() {
        if (YMConfig.YM_IS_RELEASE) {
            return ImageUrl;
        } else {
            return ImageUrl_TEST;
        }
    }


    // 测试后台地址
    public static String ServerHost_TEST = getServerTest();


    /**
     * 获取选择的测试地址
     *
     * @return
     */
    public static String getServerTest() {
        return PreferenceHelper.readString(ShiliaoApplication.getInstance(),
                YMKeyUtils.FILE_YM_CONFIG, KEY_TEST_SERVER,
                ServerTest);
    }

    /**
     * 保存测试地址
     *
     * @param serverTest
     */
    public static void saveServerTest(String serverTest) {
        PreferenceHelper.write(ShiliaoApplication.getInstance(),
                YMKeyUtils.FILE_YM_CONFIG, KEY_TEST_SERVER,
                serverTest);

    }

    /**
     * 每日知识对比和刷新的url
     */
    public static final String DAILY_KNOW_COTURL = YMConfig.YM_IS_RELEASE ?
            ServerHost + "/article.php?id=" :
            ServerTest + "/meirongknowledge/article.php?id=";
    public static final String DAILY_KNOW_REFERASHURL = YMConfig.YM_IS_RELEASE ?
            ServerHost + "/default.php" :
            ServerTest + "/meirongknowledge/default.php";

    /**
     * 我的收藏对比和收藏的url
     */
    public static final String MY_FAVORITES_COTURL = YMConfig.YM_IS_RELEASE ?
            ServerHost + "/article.php?id=" :
            ServerTest + "/meirongknowledge/article.php?id=";
    public static final String MY_FAVORITES_REFERASHURL = YMConfig.YM_IS_RELEASE ?
            ServerHost + "/myarticle.php?user_id=" :
            ServerTest + "/meirongknowledge/myarticle.php?user_id=";

    /**
     * 常见问题对比和收藏的url
     */
    public static final String COMMON_PROBLEM_COTURL = YMConfig.YM_IS_RELEASE ?
            ServerHost + "/question.php?id=" :
            ServerTest + "/meirongknowledge/question.php?id=";
    public static final String COMMON_PROBLEM_REFERASHURL = YMConfig.YM_IS_RELEASE ?
            ServerHost + "/faq.php" :
            ServerTest + "/meirongknowledge/faq.php";

    /**
     * 最新问题对比和收藏的url
     */
    public static final String LATEST_PROBLEM_COTURL = YMConfig.YM_IS_RELEASE ?
            ServerHost + "/question.php?id=" :
            ServerTest + "/meirongknowledge/question.php?id=";
    public static final String LATEST_PROBLEM_REFERASHURL = YMConfig.YM_IS_RELEASE ?
            ServerHost + "/recentquestion.php" :
            ServerTest + "/meirongknowledge/recentquestion.php";


    /**
     * css路径
     */
    public static final String BASE_URL = YMConfig.YM_IS_RELEASE ?
            YMServerUtil.ServerHost + "/" :
            YMServerUtil.ServerTest + YMServerUtil.SERVER_PORT + "/";

    /**
     * 获取uesr_id接口
     */

    public static final String GET_USER_ID = "/getuserid.php";
    public static final String CHECK_MESSAGE = "/ifnewmessage.php";

    /**
     * 每日知识
     */
    public static final String ACTION_DAILY_KNOWLEDGE = "/default.php";

    /**
     * 用户提交问题--返回的是是否有相似的问题
     */
    public static final String ACTION_SUBMIT_QUESTION = "/submit-question.php";

    /**
     * 用户提交新问题
     */

    public static final String ACTION_SUBMIT_NEW_QUESTION = "/new-question.php";

    /**
     * 消息
     */
    public static final String ACTION_MESSAGE = "/usermessage.php";

    /**
     * 最新问题列表
     */

    public static final String ACTION_NEW_QUESTION_LIST = "/recentquestion.php";

    /**
     * 设置个人信息接口
     */

    public static final String ACTION_SETINFO = "/setuserinfo.php";

    /**
     * 获取个人信息接口
     */

    public static final String ACTION_GETINFO = "/getuserinfo.php";

    /**
     * 提交评论接口
     */
    public static final String ACTION_COMMENT = "/comment.php";
    /**
     * 收藏文章
     */

    public static final String ACTION_COLLECTION = "/store-article.php";
    /**
     * 显示用户收藏的文章
     */
    public static final String ACTION_MYARTICLE = "/myarticle.php";

    /**
     * 获取文章对应的日常提醒
     */
    public static final String ACTION_REMIND = "/getreminderofarticle.php";

    /**
     * 添加文章日常提醒
     */

    public static final String ACTION_ADD_REMIND = "/setreminder.php";
    /**
     * 获取日常提醒列表
     */

    public static final String ACTION_GET_REMIND_LIST = "/getreminderofuser.php";

    /**
     * 删除日常提醒
     */
    public static final String ACTION_DETELE_REMIND = "/deletereminder.php";

    /**
     * 常见问题列表
     */
    public static final String ACTION_COMMON_PROBLEM = "/faq.php";

    /**
     * 提交问题发言
     */

    public static final String ACTION_ANSWER_QUESTION = "/answerquestion.php";

    /**
     * 收藏问题
     */

    public static final String ACTION_CONNECTION_QUESTION = "/store-question.php";

    /**
     * 取消收藏问题接口
     */
    public static final String ACTION_CANCEL_QUESTION = "/cancel-question.php";

    /**
     * 检查问题是否收藏
     */

    public static final String ACTION_CHECK_QUESTION = "/check-question.php";

    /**
     * 我的问题列表
     */

    public static final String ACTION_MY_QUESTION = "/myquestion.php";

    /**
     * 搜索文章接口
     */

    public static final String ACTION_SREACH_ARTICLE = "/searcharticle.php";

    /**
     * 搜索问题的接口
     */

    public static final String ACTION_SREACH_PROBLE = "/searchquestion.php";

    /**
     * 分享的接口
     */
    public static final String ACTION_SHARE = "/getsharingcontent.php";

    /**
     * 取消文章收藏接口
     */
    public static final String ACTION_CANCEL_ARTICLE = "/cancel-article.php";

    /**
     * 检查文章是否收藏接口
     */
    public static final String ACTION_IS_COLLECTION = "/check-article.php";

    /**
     * 文章评价接口
     */
    public static final String ACTION_ARTICLE_EVALUATE = "/scoring.php";

    /**
     * 提交意见建议接口
     */

    public static final String ACTION_SUGGESTION = "/suggestion.php";

    /**
     * 版本更新接口
     */
    public static final String ACTION_UPDATE = "/check-update.php";

    /**
     * 获取当前的提醒内容
     */
    public static final String ACTION_NOTICE_CONTEN = "/getnoticecontent.php";
    /**
     * 获取问题分享内容
     */
    public static final String ACTION_QUESTION_SHARE = "/getquestionsharingcontent.php";
    /**
     * 个人中心--贡献点
     */
    public static final String ACTION_CONTRIBUTION_NUMBER = "/myjifen.php";
    /**
     * 分享成功后--获得贡献点
     */
    public static final String ACTION_SHARE_SUCCESS_GETONTRIBUTION = "/sharingnotice.php";

    /**
     * 获得是否需要引导
     */
    public static final String ACTION_GET_GUIDANCE = "/getguidance.php";

    /**
     * 获取内容推荐
     */
    public static final String ACTION_CONTENT_REFEREE="/recommend.php";

    /**
     * 获取动态社区内容
     */
    public static final String ACTION_DYNMIC="/dongtai.php";

    /**
     * 获取内容审核说明页
     */
    public static final String ACTION_CONTNET_EXAMINE="/audit_intro.php";

    /**
     * 检查是否是审核人员
     */
    public static final String ACTION_IS_AUDITOR="/is-auditor.php";

    /**
     * 获取待审核内容列表
     */
    public static final String ACTION_GET_TODAYAUDIT="/gettodayaudit.php";

    /**
     * 获取待审核详情
     */
    public static final String ACTION_GET_WAITEXMINE_DETAIL="/showauditcontent.php";

    /**
     *
     */
    public static final String ACTION_AUDIT_RESULT="/auditresult.php";

    /**
     * 关于我们
     */
    public static final String ACTION_ABOUT="/about.html";

    /**
     * 获取审核内容
     */

    public static final String ACTION_GET_AUDIT_RESULT="/getauditresultlist.php";
}
